
<%@ page import="Biblioteca.Emprestimo" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
       <g:if test="${tipoUsuario == 'Admin'}">
        	<meta name="layout" content="adminBiblioteca" />
        </g:if>
        <g:else>
        	<meta name="layout" content="usuarioBiblioteca" />
        </g:else>
        <g:set var="entityName" value="${message(code: 'emprestimo.label', default: 'Emprestimo')}" />
        <title><g:message code="SPL - Emprestimos" args="[entityName]" /></title>
    </head>
    <body>
        <div class="body">
            <h1><g:message code="Emprestimos" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                        
                        	<g:sortableColumn property="login" title="${message(code: 'emprestimo.login.label', default: 'Login')}" />
                  
                            <g:sortableColumn property="dataDevolucao" title="${message(code: 'emprestimo.dataDevolucao.label', default: 'Data Devolucao')}" />
                        
                            <g:sortableColumn property="dataEmprestimo" title="${message(code: 'emprestimo.dataEmprestimo.label', default: 'Data Emprestimo')}" />
                        
                             <g:sortableColumn property="id" title="Detalhes" />
                                               
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${emprestimoInstanceList}" status="i" var="emprestimoInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                        	<td>${fieldValue(bean: emprestimoInstance, field: "login")}</td>
                        
                            <td><g:formatDate date="${emprestimoInstance.dataDevolucao}" /></td>
                        
                            <td><g:formatDate date="${emprestimoInstance.dataEmprestimo}" /></td>
                                                    
                            <td class = "actionButtons">
                             
                             <span class = "actionButton">
                             
                            <g:link action="show" id="${emprestimoInstance.id}">
                              Ver mais
                            </g:link></span></td>
              
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${emprestimoInstanceTotal}" />
            </div>
        </div>
    </body>
</html>
